package com.jbooktrader.strategy;

import com.jbooktrader.indicator.price.*;
import com.jbooktrader.mytrader.Constant;
import com.jbooktrader.mytrader.SendMail;
import com.jbooktrader.platform.indicator.*;
import com.jbooktrader.platform.model.*;
import com.jbooktrader.platform.optimizer.*;
import com.jbooktrader.strategy.base.*;


/**
 *
 */
public class AG1209M5 extends StrategyAG1209 {

    // Technical indicators
    private Indicator priceBollinger, priceEMA,priceSimpleMA;

    // Strategy parameters names
    private static final String PERIOD = "Period";
    private static final String SCALE = "Scale";
    private static final String ENTRY = "Entry";
    private static final String EXIT = "Exit";
    private final int entry, exit, scale;
    
    private static double peakProfit = -9999;
	private int position = 1;
    private double maxLoss = -30;
    private double moveStop = 10;

    
    public void resetMaxLoss(){
    	maxLoss = -30;
    	peakProfit = -9999;
    }
    
    public AG1209M5(StrategyParams optimizationParams) throws JBookTraderException {
        super(optimizationParams);
        entry = getParam(ENTRY);
        exit = getParam(EXIT);
        scale = getParam(SCALE);
        setPosition(position);
    }

    @Override
    public void setParams() {
    	addParam(PERIOD, 2200, 3600, 5, 3200);
        addParam(SCALE, 5, 25, 1, 16);
        addParam(ENTRY, 55, 120, 1, 92);
        addParam(EXIT, -50, 0, 1, -21);
    }

    @Override
    public void setIndicators() {
        priceEMA = addIndicator(new PriceEMA(10));
    }

    @Override
    public void onBookSnapshot() {
    	System.out.println("AG1209M5");
    }
    
    public int getTradeSignal(){
    	System.out.println("TRADE SIGNAL");
    	return 0;
    }
    
    public void placeOrder(int tradeSignal){
    	System.out.println("PLACE ORDER");
    }
}